//
//  ViewController.m
//  04-qq音乐播放界面
//
//  Created by dllo on 16/7/19.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "ViewController.h"
#import "UIButton+Music.h"
#import "UILabel+Music.h"
#import "UIImageView+Music.h"
#import "Masonry.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // 毛玻璃
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:1];
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blur];
    [self.view addSubview:effectView];
    [effectView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.right.mas_equalTo(0);
        
    }];
//    effectView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    
    // 返回button
    self.backMusicImageView = [UIImageView backButtonCreated];
    [self.view addSubview:_backMusicImageView];
    [self.backMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(-8);
        make.top.mas_equalTo(-5);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
        
    }];
    // 歌名label
    self.songNameMusicLabel = [UILabel songNameLabelCreated];
    [self.view addSubview:_songNameMusicLabel];
    [self.songNameMusicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(55);
        make.top.mas_equalTo(20);
        make.width.mas_equalTo(304);
        make.height.mas_equalTo(30);
        
    }];
    // 更多
    self.moreMusicImageView = [UIImageView moreButtonCreated];
    [self.view addSubview:_moreMusicImageView];
    [self.moreMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(366);
        make.top.mas_equalTo(19);
        make.width.mas_equalTo(32);
        make.height.mas_equalTo(32);
        
    }];
    // 歌手民
    self.singerMusicLabel = [UILabel singerLabelCreated];
    [self.view addSubview:_singerMusicLabel];
    [self.singerMusicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(103.5);
        make.top.mas_equalTo(50);
        make.width.mas_equalTo(207);
        make.height.mas_equalTo(30);
        
    }];
    // 独家
    self.dujiaMusicImageView = [UIImageView dujiaImageViewCreated];
    [self.view addSubview:_dujiaMusicImageView];
    [self.dujiaMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(187);
        make.top.mas_equalTo(96);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(18);
        
    }];
    // 标准
    self.standardMusicImageView = [UIImageView standardImageViewCreated];
    [self.view addSubview:_standardMusicImageView];
    [self.standardMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(112);
        make.top.mas_equalTo(96);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(18);
        
    }];
    // dts
    self.dtsMusicImageView = [UIImageView dtsImageViewCreated];
    [self.view addSubview:_dtsMusicImageView];
    [self.dtsMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(257);
        make.top.mas_equalTo(96);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(18);
        
    }];
    // 专辑封面
    self.albumView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH / 3 * 2, WIDTH / 3 * 2)];
    [self.albumView setImage:[UIImage imageNamed:@"icon_albulm"]];
    self.albumView.center = CGPointMake(WIDTH / 2, HEIGHT / 2 - 100);
    self.albumView.layer.cornerRadius = WIDTH / 3;
    self.albumView.layer.masksToBounds = YES;
    self.albumView.layer.borderWidth = 2;
    self.albumView.layer.borderColor = [UIColor darkGrayColor].CGColor;
    [self.view addSubview:self.albumView];
    [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(69);
        make.top.mas_equalTo(130);
        make.width.mas_equalTo(276);
        make.height.mas_equalTo(276);
        
    }];
    // 歌词
    self.lyricMusicLabel = [UILabel lyricLabelCreated];
    [self.view addSubview:_lyricMusicLabel];
    [self.lyricMusicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(55);
        make.top.mas_equalTo(431);
        make.width.mas_equalTo(304);
        make.height.mas_equalTo(30);
        
    }];
    // pageControll控件
    self.pageMusic = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];
    self.pageMusic.center = CGPointMake(WIDTH / 2, HEIGHT / 2 - 100 + WIDTH / 3 + 40 + 30 + 20);
    self.pageMusic.pageIndicatorTintColor = [UIColor brownColor];
    self.pageMusic.currentPageIndicatorTintColor = [UIColor whiteColor];
    self.pageMusic.numberOfPages = 3;
    self.pageMusic.currentPage = 1;
    [self.view addSubview:_pageMusic];
    [self.pageMusic mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(177);
        make.top.mas_equalTo(481);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(30);
        
    }];
    // slider控件
    self.sliderMusic = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, WIDTH - 110 - 20, 30)];
    self.sliderMusic.center = CGPointMake(WIDTH / 2, HEIGHT / 2 - 100 + WIDTH / 3 + 40 + 30 + 20 + 30 + 10);
    [self.sliderMusic setMaximumTrackImage:[UIImage imageNamed:@"player_slider_playback_right"] forState:0];
    [self.sliderMusic setMinimumTrackImage:[UIImage imageNamed:@"player_slider_playback_left"] forState:0];
    [self.sliderMusic setThumbImage:[UIImage imageNamed:@"player_slider_playback_thumb"] forState:0];
    [self.view addSubview:_sliderMusic];
    [self.sliderMusic mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(65);
        make.top.mas_equalTo(521);
        make.width.mas_equalTo(284);
        make.height.mas_equalTo(30);
        
    }];
    // 当前时间
    self.currentTimeLabel = [UILabel currentTimeLabelCreated];
    [self.view addSubview:_currentTimeLabel];
    [self.currentTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(9.5);
        make.top.mas_equalTo(521);
        make.width.mas_equalTo(45);
        make.height.mas_equalTo(30);
        
    }];
    // 总时长
    self.TotalTimeLabel = [UILabel totalLengthOfTheSongLabelCreated];
    [self.view addSubview:_TotalTimeLabel];
    [self.TotalTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(359.5);
        make.top.mas_equalTo(521);
        make.width.mas_equalTo(45);
        make.height.mas_equalTo(30);
        
    }];
    // 播放
    self.playMusicImageView = [UIImageView playImageViewCreated];
    [self.view addSubview:_playMusicImageView];
    [self.playMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(175);
        make.top.mas_equalTo(564);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(64);
        
    }];
    // 上一首
    self.preMusicImageView = [UIImageView preSongImageViewCreated];
    [self.view addSubview:_preMusicImageView];
    [self.preMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(95);
        make.top.mas_equalTo(564);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(64);
        
    }];
    // 下一首
    self.nextMusicImageView = [UIImageView nextSongImageViewCreated];
    [self.view addSubview:_nextMusicImageView];
    [self.nextMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(255);
        make.top.mas_equalTo(564);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(64);
        
    }];
    // 下载
    self.downLoadMusicImageView = [UIImageView downloadImageViewCreated];
    [self.view addSubview:_downLoadMusicImageView];
    [self.downLoadMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(182);
        make.top.mas_equalTo(641);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
    // 循环模式
    self.repeatMusicImageVIew = [UIImageView repeatImageViewCreated];
    [self.view addSubview:_repeatMusicImageVIew];
    [self.repeatMusicImageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(122);
        make.top.mas_equalTo(641);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
    // 分享
    self.shareMusicImageVIew = [UIImageView shareImageViewCreated];
    [self.view addSubview:_shareMusicImageVIew];
    [self.shareMusicImageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(242);
        make.top.mas_equalTo(641);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
    // 爱心
    self.favoriteMusicImageVIew = [UIImageView favoriteImageViewCreated];
    [self.view addSubview:_favoriteMusicImageVIew];
    [self.favoriteMusicImageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(62);
        make.top.mas_equalTo(641);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
    // 列表
    self.playlistMusicImageVIew = [UIImageView playlistImageViewCreated];
    [self.view addSubview:_playlistMusicImageVIew];
    [self.playlistMusicImageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(302);
        make.top.mas_equalTo(641);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
    // qplay
    self.qplayMusicImageView = [UIImageView qplayImageViewCreated];
    [self.view addSubview:_qplayMusicImageView];
    [self.qplayMusicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(31);
        make.top.mas_equalTo(580);
        make.width.mas_equalTo(32);
        make.height.mas_equalTo(32);
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
